package com.project.mapper;

import com.project.bean.SpeakBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ISpeakMapper {

    @Insert("INSERT INTO t_speak(fk_userId,fk_bookId,s_content,s_date)" +
            "VALUES(#{user.id},#{book.id},#{content},#{date})")
    public void add(SpeakBean speak);

    /**
     * 按书籍查询评论，同时查询评论用户名
     * @param bookId 书籍id
     * @return 评论集合
     */
    public List<SpeakBean> findByBook(Integer bookId);
}
